/**
 * 通知管理初始化
 */
var InitPortalData = {
    processInterval:null
};



$(function () {
    $HUI.combobox('#QCDic',
        {
            data:$.parseJSON($("#entityMap").val()),
            valueField:'value',
            textField:'text',
            defaultFilter: 6
        })
});

/**
 * 手动生成数据
 */


InitPortalData.manual = function(){
    var ajax = new $ax("/api/updateEntityRecommendData", function (data) {
        $.messager.popover({msg: '操作成功！',type:'success',timeout: 1000,style:{top:($(window).height()-50)/2+$(document).scrollTop(),left:($(window).width()-140)/2+$(document).scrollLeft()}})
    }, function (data) {
        $.messager.alert("错误提示", "状态更新错误!", 'info');
    });
    ajax.set('entityId', Common_GetValue('QCDic'));
    ajax.start();
}

InitPortalData.log = function(){
    var qcEntity = $("#QCDic").combobox("getValue");
    var index = Sys.open_c('CDSS推荐数据初始化日志记录', '/api/initCdssRecommendData/log?qcEntity=' + qcEntity, ['1000px', '500px'], function () {
    });
    this.layerIndex = index;
}


//取值
function Common_GetText() {
    var itmValue = '';

    if (typeof(arguments[0]) !== 'string') return '';
    if (arguments[0] == '') return '';

    var $this = $('#'+ arguments[0]);
    if ($this.length < 1) return '';

    var className = $this.attr("class").split(' ')[0];

    if (className == 'textbox') {  //文本框
        itmValue = $this.val();
    }else if (className == 'hisui-numberbox') {  //数字
        itmValue = $this.val();
    }else if (className == 'hisui-datebox') {  //日期
        itmValue = $this.datebox('getValue');
    }else if (className == 'hisui-timespinner') {  //时间框
        itmValue = $this.timespinner('getValue');
    }else if (className == 'hisui-combobox') {  //下拉框
        itmValue = $this.combobox('getText');
    }else if (className == 'hisui-switchbox') {  //开关
        itmValue = $this.switchbox('getValue');
    }else if (className == 'hisui-checkbox') {  // 单个复选框
        itmValue = $this.attr("label");
    }else if (className == 'hisui-radio') {  //单个单选框
        itmValue =$this.attr("label");
    }else if (className == 'hisui-searchbox') {  //查询框框
        itmValue = $this.searchbox('getValue');
    }

    return itmValue;
}

function Common_GetValue() {
    var itmValue = '';

    if (typeof(arguments[0]) !== 'string') return '';
    if (arguments[0] == '') return '';

    var $this = $('#'+ arguments[0]);
    if ($this.length < 1) return '';

    var className = $this.attr("class").split(' ')[0];

    if (className == 'textbox') {  //文本框
        itmValue = $this.val();
    }else if (className == 'hisui-numberbox') {  //数字
        itmValue = $this.val();
    }else if (className == 'hisui-datebox') {  //日期
        itmValue = $this.datebox('getValue');
    }else if (className == 'hisui-timespinner') {  //时间框
        itmValue = $this.timespinner('getValue');
    }else if (className == 'hisui-combobox') {  //下拉框（多选下拉框没有封装）
        itmValue = $this.combobox('getValue');
    }else if (className == 'hisui-switchbox') {  //开关
        itmValue = $this.switchbox('getValue');
    }else if (className == 'hisui-checkbox') {  // 单个复选框
        itmValue = $this.checkbox('getValue');
    }else if (className == 'hisui-radio') {  //单个单选框
        itmValue = $this.radio('getValue');
    }else if (className == 'hisui-searchbox') {  //查询框框
        itmValue = $this.searchbox('getValue');
    }

    return itmValue;
}



